package org.feiye.studyday28;

import java.io.*;
import java.net.*;

public class Clientside {
	public static void main(String[] args) {
		Socket s = null;
		OutputStream o = null;
		try {
			s = new Socket("192.168.10.93", 6666);
			InputStream is = s.getInputStream();
			int len = 0;
			o = new FileOutputStream("E:\\pic\\1.jpg");
			while ((len = is.read()) > -1) {
				o.write(len);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (o != null)
				try {
					o.close();
				} catch (Exception e) {
					e.printStackTrace();
				}
			if (s != null) {
				try {
					s.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}

		}
	}
}
